home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_10_12
/
windstr.h
< prev
next >
Wrap
C/C++ Source or Header
|
1992-07-24
|
938b
|
44 lines
Listing 2
// WINDSTR.H
#ifndef _WINDSTR_H
#define _WINDSTR_H
#include <iostream.h>
#include "window.h"
class WindowBuffer : public streambuf {
Window *wndptr;
public:
WindowBuffer (Window *wnd)
{ wndptr=wnd; unbuffered(l); }
virtual int overflow (int ch)
{ if(wndptr) {
wndptr->wputchar(ch);
return ch;
} else{
return EOF;
}
}
Window *window () const
{ return wndptr; }
WindowBuffer& operator = (Window *wnd)
{ wndptr=wnd; return *this; }
};
class WindowStroam : public ostream {
WindowBuffer *buf;
public:
Windowstream(Window *wnd=NULL) : ostream()
{ buf=new WindowBuffer(wnd); ios::init(buf); }
virtual ~WindowStream ()
{ if(buf) delete buf; }
WindowStream& operater = (Window *wnd)
{ *buf=wnd; return *this; }
};
#endif //_WINDSTR_H